import Main from '@/view/main'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 * }
 */
import {allRoles} from '../libs/util'

export default [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: '登录',
      hideInMenu: true
    },
    component: () => import('@/view/login')
  },
  {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
      hideInMenu: true,
      notCache: true
    },
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          hideInMenu: true,
          title: '首页',
          notCache: true
        },
        component: () => import('@/view/home/index')
      }
    ]
  },
  {
    path: '/report',
    name: '报表管理',
    component: Main,
    meta: {
      title: '',
      icon:'ios-podium-outline',
      showAlways:true,
      access: [allRoles.manager,allRoles.sales,allRoles.statistician]
    },
    children:[
      { path: '/',meta:{icon: 'md-body', title: '我的报表' ,access: [allRoles.manager,allRoles.sales]}, name: 'myReport', component: () => import('@/view/report/my/report') },
      { path: 'sub',meta:{icon: 'md-people',title: '下级报表',access:[allRoles.manager,allRoles.statistician]}, name: 'subReport', component: () => import('@/view/report/subManager/subReport') },
     ]
  },
  {
    path: '/clue',
    name: '线索管理',
    component: Main,
    meta: {
      title: '',
      icon:'logo-rss',
      showAlways:true,
      access: [allRoles.manager,allRoles.sales,allRoles.admin]
    },
    children:[
      { path: '/',meta:{icon: 'ios-globe-outline', title: '销售线索',access:[allRoles.manager]}, name: 'clueManage', component: () => import('@/view/clue/clue') },
      { path: '/query',meta:{icon: 'md-search', title: '线索查询',access:[allRoles.admin,allRoles.sales,allRoles.manager]}, name: 'assigneQuery', component: () => import('@/view/clue/query/query') },
      { path: '/history',meta:{icon: 'ios-rewind-outline', title: '历史线索',access:[allRoles.manager]}, name: 'historyClue', component: () => import('@/view/clue/history/history') },

     ]
  },
  {
    path: '/system',
    name: '系统管理',
    component: Main,
    meta: {
      title: '',
      icon:'ios-settings-outline',
      showAlways:true,
      access: [allRoles.manager,allRoles.admin,allRoles.access]
    },
    children:[
      { path: 'member',meta:{icon: 'ios-person-outline', title: '企业管理员',access: [allRoles.admin,allRoles.access]}, name: 'system_user', component: () => import('@/view/system/manager') },
      { path: 'enterprise',meta:{icon: 'ios-cube-outline', title: '企业管理',access: [allRoles.manager,allRoles.admin]}, name: 'system_enterprise', component: () => import('@/view/system/enterprise') },
      { path: 'subMember',meta:{icon: 'md-people',title: '下级管理',access: [allRoles.manager,allRoles.admin]}, name: 'system_sub_user', component: () => import('@/view/system/user') },
      { path: 'log',meta:{icon: 'ios-aperture',title: '系统日志',access: [allRoles.manager,allRoles.admin]}, name: 'system_log', component: () => import('@/view/system/log') },
    ]
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  }
]
